function onEvent() {
    function f() {
        $(this).addClass("hover-tips");
        $(this).find(".mask-img").show();
        $(this).find(".intro-text").show();
        0 < $(this).find(".go-buy").length && ($(this).find(".go-buy").show(), $(this).find(".buy-info").hide())
    }
    function b() {
        $(this).removeClass("hover-tips");
        $(this).find(".mask-img").hide();
        $(this).find(".intro-text").hide();
        0 < $(this).find(".go-buy").length && ($(this).find(".go-buy").hide(), $(this).find(".buy-info").show())
    }
    function e() {
        var b = $(window).scrollTop();
        0 < $(".go-top").length && 
        (100 < b ? $(".go-top").show() : $(".go-top").hide());
        var a = $(".main-nav").offset().top + 60;
        0 < $(".event_container").length && (a = $("#content").offset().top);
        if (0 < $(".shop-wrap").length) {
            var d = $(".shop-wrap").offset().top,
            a = b - a,
            b = b - d;
            k.fix();
            0 < a ? ($(".left-side").removeClass("start-side"), $(".left-side").addClass("fixed-side"), $(".side-sign-org").hide(), $(".side-sign-sup").show()) : ($(".left-side").removeClass("fixed-side"), $(".left-side").addClass("start-side"), $(".side-sign-org").show(), $(".side-sign-sup").hide());
            0 < b ? $("#nav-menu").addClass("line-fixed") : $("#nav-menu").removeClass("line-fixed")
        }
		
		if(0 < $(".brand-nav-wrap").length){
			var st = $(window).scrollTop();
			headh = $("div.site-top-nav").height()+$("div.search").height()+$("div.main-nav").height(); 
			$nav_classify = $("div.brand-nav-wrap");
			if(st > headh){
				$nav_classify.addClass("brand-nav-fix");
			} else {
				$nav_classify.removeClass("brand-nav-fix");
			}
		}

		if(0 < $(".jiu-nav-main").length){
			var st = $(window).scrollTop();
			headh = $("div.site-top-nav").height()+$("div.search").height()+$("div.main-nav").height(); 
			$jiu_nav = $("div.jiu-nav-main");
			if(st > headh){
				$jiu_nav.addClass("fixed");
			} else {
				$jiu_nav.removeClass("fixed");
			}
		}
    }
    $(".shop-type a").click(function() {
        $(".shop-type a").removeClass("selected");
        $(this).addClass("selected")
    });
    $(".down-app-box").hover(function() {
        $(".app-box").show()
    },
    function() {
        $(".app-box").hide()
    });
    1 <= $(".go-top").length && $(".side-pannel").remove();
    $(".go-top").hover(function() {
        $(this).text("\u56de\u9876\u90e8");
        $(this).css("background-position", "-98px -437px")
    },
    function() {
        $(this).text("");
        $(this).css("background-position", 
        "-18px -437px")
    });
    $(".go-top").click(function() {
        $(window).scrollTop(0)
    }); (function() {
        var b = [20, 86, 154, 222, 292, 360, 425, 506, 602, 693, 737, 828];
        1 <= $("#top_recom_page").length && (b = [16, 87, 153, 222, 294, 360]);
        $(".nav-box li").click(function() {
            $(".nav-box li").removeClass("selected");
            $(this).addClass("selected");
            var a = $(".nav-box li").index(this);
            $(".short-line").animate({
                marginLeft: b[a] + "px"
            },
            100)
        });
        var a = $(".nav-box li").index($(".nav-box li.selected"));
        $(".short-line").css("margin-left", b[a])
    })();
    $(".inner-item").live({
        mouseenter: function() {
            f.apply(this)
        },
        mouseleave: function() {
            b.apply(this)
        }
    });

 
	
    var k = function() {
        document.getElementsByTagName("html");
        return {
            fix: function() {}
        }
    } ();
    $(window).scroll(e);
    e(); ({
        init: function() {
            0 != $(".J_new-user").length && !$.cookie("new_user_show") && ($.cookie("new_user_show", "1", {
                expires: 1
            }), this.bindEvent())
        },
        bindEvent: function() {
            var b = this; ! $.mz.isLogin() && (!$.cookie("_last_login_id_") && !$.cookie("new_user_clicked")) && (this.popBox(), b.sendRegpacketLog("show"), $(".J_new-user-close").bind("click", 
            function() {
                $.cookie("new_user_clicked", 
                1, {
                    expires: 15
                });
                $.colorbox.close()
            }), $(".J_new-user-packet").bind("click", 
            function(a) {
                b.sendRegpacketLog("click");
                $.cookie("new_user_clicked", 1, {
                    expires: 15
                });
                $.cookie("_done_", $.base64Encode($.base64Decode(g.__b__) + "reg_award/reg_redpacket.html"));
                $.colorbox.close()
            }))
        },
        sendRegpacketLog: function(b) {
            b && window.mz_record.add({
                hxid: $.cookie("hxid") || $.cookie("JSESSIONID"),
                rid: 19001,
                sid: $.cookie("_logged_") || "",
                xid: $.cookie("st_au") || "",
                et: b,
                entity_type: "reg_award",
                entity_list: [""],
                json: {
                    url: window.location.href,
                    block_name: "\u6ce8\u518c\u9886\u7ea2\u5305\u6d3b\u52a8\uff08\u9996\u9875\u5f39\u7a97\uff09"
                }
            }).send()
        },
        popBox: function() {
            $.colorbox({
                html: $(".J_new-user").html(),
                innerWidth: 670,
                innerHeight: 400,
                initialWidth: 670,
                initialHeight: 400,
                opacity: "0.7",
                fixed: !0,
                scrolling: !1,
                overlayClose: !0,
                close: ""
            })
        }
    }).init()
}

function show_date_time(f, b, e, k) {
    today = new Date;
    timeDiff = today.getTime() - 1E3 * b;
    timeold = 1E3 * f - today.getTime();
    0 > timeold ? "undefined" != typeof dingdong && (!0 == dingdong && "undefined" != typeof k) && (dingdong = !1, tuan_start()) : ("undefined" != typeof k ? setTimeout("show_date_time(" + f + "," + e + "," + k + "," + k + ")", 100) : setTimeout("show_date_time(" + f + "," + e + "," + k + ")", 100), sectimeold = timeold / 1E3, secondsold = Math.floor(sectimeold), msPerDay = 864E5, e_daysold = timeold / msPerDay, daysold = Math.floor(e_daysold), e_hrsold = 24 * (e_daysold - daysold), 
    hrsold = Math.floor(e_hrsold), e_minsold = 60 * (e_hrsold - hrsold), minsold = Math.floor(60 * (e_hrsold - hrsold)), e_seconds = 60 * (e_minsold - minsold), seconds = Math.floor(60 * (e_minsold - minsold)), ms = e_seconds - seconds, ms = new String(ms), ms1 = ms.substr(2, 1), ms2 = ms.substr(2, 2), hrsold1 = 24 * daysold + hrsold, $("#end_date_" + k).html("<em>" + (10 > hrsold1 ? "0" + hrsold1: hrsold1) + "</em>\u5c0f\u65f6<em>" + (10 > minsold ? "0" + minsold: minsold) + "</em>\u5206<em>" + (10 > seconds ? "0" + seconds: seconds) + "\u79d2</em>"));
}

function initTuanFun() {
	if(0 < $(".countdown #end_date_1").length){
			var f = $("#end_date_1");
			show_date_time(f.attr("data-end-time"), f.attr("data-current-time"), 1, 1);
	}

	onEvent();


}

$(window).on("load", 
    function() {
        var e = $(".intro-box").offset().top,
        t = $(".nav-menu-wrap"),
        i = $(".cart-duplication");
        setTimeout(function() {
            var n = function() {
                var n = document.body.scrollTop || document.documentElement.scrollTop;
                n >= e ? (t.addClass("nav-bar-fixed"), i.show()) : (t.removeClass("nav-bar-fixed"), i.hide())
            };
            n(),
            $(window).on("scroll", n)
        },
        500)
});

$(".nav-menu li").on("click", 
		function() {
            $(".nav-menu li").removeClass("current"),
            $(this).addClass("current");
           
 });


initTuanFun();
 